package com.wing.cabinet.model.response;

import com.wing.cabinet.model.entity.CabinetCargoSpace;
import com.wing.cabinet.utils.ExcelExport;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import com.wing.cabinet.model.entity.StorageInventoryKnife;
import org.apache.commons.lang.StringUtils;

/**
 * 刀具产品货道库存VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class StorageInventoryKnifeVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    @ExcelExport(value = "创建时间",sort = 110)
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * 柜子编号
     */
    @ExcelExport(value = "柜子编号",sort = 50)
    private String cabCode;

    /**
     * 货道id
     */
    private Long spaceId;

    /**
     * 货道编号
     */@ExcelExport(value = "货位编号",sort = 60)

    private String spaceCode;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * sku 编号
     */
    @ExcelExport(value = "物料编号",sort = 20)
    private String skuCode;

    /**
     * 库存数量
     */
    @ExcelExport(value = "数量",sort = 70)
    private Integer quantity;

    /**
     * 业务类型
     */
    private StorageInventoryKnife.BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        return businessType.getDesc();
    }

    /**
     * 是否已同步：no(0,未同步);yes(1,已同步);
     */
    private Integer isSyns;

    /**
     * 同步时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime synsTime;

    /**
     * deviceCode
     */
    private String deviceCode;

    /**
     * companyId
     */
    private Long companyId;

    /**
     * 存取刀id
     */
    private Long storageInventoryInoutId;

    /**
     * labelCode
     */
    @ExcelExport(value = "刀具条码",sort = 80)
    private String labelCode;

    private Long storageInventoryUserId;



    /**
     * sku 名称
     */
    @ExcelExport(value = "物料名称",sort = 10)
    private String skuName;

    /**
     * sku 规格
     */
    private String skuSpec;

    /**
     * sku 图片
     */
    private String skuPic;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品类型名称
     */
    private String productTypeName;

    /**
     * 产品分类名称
     */
    private String productCategoryName;

    /**
     * 产品品牌
     */
    @ExcelExport(value = "品牌",sort = 40)
    private String productBrandName;

    /**
     * 产品型号
     */
    private String productModelName;

    /**
     * 适配机床
     */
    private String deviceName;

    /**
     * 市场价
     */
    private BigDecimal marketPrice;


    private CabinetCargoSpace.SpaceType spaceType;

    private String spaceTypeDesc;

    public String getSpaceTypeDesc(){
        if (spaceType!=null){
            if (StringUtils.isNotBlank(this.principal)){
                return "专人"+spaceType.getDesc();
            }else{
                return spaceType.getDesc();
            }

        }
        return "";
    }

    @ExcelExport(value = "规格码",sort = 30)
    private String skuSpecOld;

    private String skuCodeOld;


    private Boolean showPriceFlag=true;

    private Long workOrderId;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime inTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime outTime;

    //@ExcelExport(value = "刀具寿命",sort = 90)
    private Integer remainingTime;


    /**
     * 寿命单位  1：小时/ 2：次数
     */
    //@ExcelExport(value = "寿命单位",sort = 100,kv = "minute-分钟;number-个数")
    private StorageInventoryKnife.LifeUnit lifeUnit;
    @ExcelExport(value = "寿命单位",sort = 100)
    private String lifeUnitName;

    private StorageInventoryKnife.BusinessDetailType businessDetailType;

    private Integer settingTime;

    private String knifeRemark;

    private String lifeUnitDesc;

    public String getLifeUnitDesc(){
        if (this.lifeUnit!=null){
            return this.lifeUnit.getDesc();
        }
        return "";
    }
    private String principal;

    private StorageInventoryKnife.LoadingType loadingType;

    private Long categoryId;

    private Long processId;


    private BigDecimal price;
    private Integer quantityPackUnit;

    private Long packId;

    private String packName;


    private Integer quantityPack;
    @ExcelExport(value = "基础单位",sort = 71)
    private String basicsUnitName;
    @ExcelExport(value = "刀具寿命",sort = 90)
    private String remainingSettingTime;
}
